/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test1;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Costel
 */
@Entity
@Table(name = "membri_gospodarie")
@NamedQueries({@NamedQuery(name = "MembruGospodarie.findAll", query = "SELECT m FROM MembruGospodarie m"), @NamedQuery(name = "MembruGospodarie.findById", query = "SELECT m FROM MembruGospodarie m WHERE m.id = :id"), @NamedQuery(name = "MembruGospodarie.findByVersion", query = "SELECT m FROM MembruGospodarie m WHERE m.version = :version"), @NamedQuery(name = "MembruGospodarie.findByNume", query = "SELECT m FROM MembruGospodarie m WHERE m.nume = :nume"), @NamedQuery(name = "MembruGospodarie.findByPrenume", query = "SELECT m FROM MembruGospodarie m WHERE m.prenume = :prenume"), @NamedQuery(name = "MembruGospodarie.findByCnp", query = "SELECT m FROM MembruGospodarie m WHERE m.cnp = :cnp"), @NamedQuery(name = "MembruGospodarie.findBySex", query = "SELECT m FROM MembruGospodarie m WHERE m.sex = :sex"), @NamedQuery(name = "MembruGospodarie.findByCod", query = "SELECT m FROM MembruGospodarie m WHERE m.cod = :cod"), @NamedQuery(name = "MembruGospodarie.findByDataNasterii", query = "SELECT m FROM MembruGospodarie m WHERE m.dataNasterii = :dataNasterii"), @NamedQuery(name = "MembruGospodarie.findByMentiuni", query = "SELECT m FROM MembruGospodarie m WHERE m.mentiuni = :mentiuni")})
public class MembruGospodarie implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Column(name = "VERSION")
    private BigInteger version;
    @Column(name = "nume")
    private String nume;
    @Column(name = "prenume")
    private String prenume;
    @Column(name = "cnp")
    private String cnp;
    @Column(name = "sex")
    private Integer sex;
    @Column(name = "cod")
    private String cod;
    @Column(name = "dataNasterii")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dataNasterii;
    @Column(name = "mentiuni")
    private String mentiuni;
    @JoinColumn(name = "TITULAR_ID", referencedColumnName = "ID")
    @ManyToOne(fetch = FetchType.EAGER)
    private Titulari titularId;
    @JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Titulari titulari;

    public MembruGospodarie() {
    }

    public MembruGospodarie(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BigInteger getVersion() {
        return version;
    }

    public void setVersion(BigInteger version) {
        this.version = version;
    }

    public String getNume() {
        return nume;
    }

    public void setNume(String nume) {
        this.nume = nume;
    }

    public String getPrenume() {
        return prenume;
    }

    public void setPrenume(String prenume) {
        this.prenume = prenume;
    }

    public String getCnp() {
        return cnp;
    }

    public void setCnp(String cnp) {
        this.cnp = cnp;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getCod() {
        return cod;
    }

    public void setCod(String cod) {
        this.cod = cod;
    }

    public Date getDataNasterii() {
        return dataNasterii;
    }

    public void setDataNasterii(Date dataNasterii) {
        this.dataNasterii = dataNasterii;
    }

    public String getMentiuni() {
        return mentiuni;
    }

    public void setMentiuni(String mentiuni) {
        this.mentiuni = mentiuni;
    }

    public Titulari getTitularId() {
        return titularId;
    }

    public void setTitularId(Titulari titularId) {
        this.titularId = titularId;
    }

    public Titulari getTitulari() {
        return titulari;
    }

    public void setTitulari(Titulari titulari) {
        this.titulari = titulari;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MembruGospodarie)) {
            return false;
        }
        MembruGospodarie other = (MembruGospodarie) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "test1.MembruGospodarie[id=" + id + "]";
    }

}
